/**
 * @Company: 云南奇讯科技有限公司
 * @Author: yxf
 * @Description:
 * @Version: 1.0.0
 * @Date: 2021/11/3 16:14
 */

package service

import (
	"context"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/util/gconv"
	"github.com/tiger1103/gfast/v3/internal/app/plugins/sms/driver"
)

type demoService struct {}

var Demo = new(demoService)

// SendTemplateSms 发送模板短信
func (s *demoService) SendTemplateSms(args *driver.SendSmsArgs) (err error) {
	g.Log().Info(args.Ctx,"发送成功,这里是测试")
	return
}

// SendVerifyCode 发送短信验证码
func (s *demoService) SendVerifyCode(args *driver.SendSmsArgs) (err error) {
	mobile := args.Mobiles[0]
	verifyCode, err := Sms.CreateVerifyCode(args.Ctx,mobile)
	if err != nil {
		return
	}
	g.Log().Info(args.Ctx,"发送成功,测试验证码为："+gconv.String(verifyCode))
	return
}

// CheckVerifyCode 验证短信验证码
func (s *demoService) CheckVerifyCode(ctx context.Context,mobile string, code string) (err error) {
	return Sms.CheckVerifyCode(ctx,mobile, code)
}


